package com.example.springboot.指标监控acutuator.自定义监控;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;

@Component
@Endpoint(id = "myservers") //自定义监控
// http://localhost:8080/actuator/myservers
public class MyServersAndPoint {

    @ReadOperation//端点读操作
    public Map getDockerInfo(){
        return Collections.singletonMap("我的","自定义");
    }
    @WriteOperation//端点写操作
    public void stopDocker(){
        System.out.println("docker stopped");
    }
}
